package recycle.service;

import io.vertx.core.Future;
import io.vertx.core.json.JsonObject;
import recycle.pojo.Station;
import recycle.repository.StationRepository;

public class StationService {
    private final StationRepository stationRepository;

    public StationService(StationRepository stationRepository) {
        this.stationRepository = stationRepository;
    }

    public Future<Long> create(Station station) {
        return stationRepository.insert(station);
    }

    public Future<JsonObject> list(Station station , Integer pageNum, Integer pageSize) {
        return stationRepository.selectList( station , pageNum, pageSize);
    }

    public Future<Station> details(Long id) {
        return stationRepository.selectById(id);
    }

    public Future<Void> update(Station station) {
        return stationRepository.updateById(station);
    }

    public Future<Void> delete(Long id) {
        return stationRepository.deleteById(id);
    }

    public Future<Void> clear(Long id) {
        return stationRepository.clearStorage(id);
    }
}